package zcj.stu;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.ServletRequestParameterPropertyValues;

public class TestServletDataBinding {
    public static void main(String[] args) {
        User user = new User();
        ServletRequestDataBinder servletRequestDataBinder = new ServletRequestDataBinder(user);
//        servletRequestDataBinder.initDirectFieldAccess();
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setParameter("name","朱传杰");
        request.setParameter("age","18");
        request.setParameter("birthday","2022|01|02");
        servletRequestDataBinder.bind(new ServletRequestParameterPropertyValues(request));
        System.out.println(user);
    }
}
